#include "postdetaildialog.h"
#include "ui_postdetaildialog.h"
#include "flowcontroler.h"
#include "postcard.h"
#include <QDebug>

PostDetailDialog::PostDetailDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PostDetailDialog)
{
    ui->setupUi(this);
    setWindowTitle("帖子信息查看");

    // 设置调整大小策略
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // 调整对话框大小以适应内容
    adjustSize();
}

PostDetailDialog::~PostDetailDialog()
{
    delete ui;
}

void PostDetailDialog::setPost(const Core::Post &post)
{

    ui->labUser->setText(post.userName);
    ui->labTime->setText(post.createdAt);
    ui->editTitle->setText(post.title);
    ui->editContent->setText(post.content);


    //1///////////////////////////////////////////////////////////////////////////////////////////////////
    //QPixmap pixmap = QPixmap(":/res/kongbai.png");
    //ui->label_4->setPixmap(pixmap);
    //1///////////////////////////////////////////////////////////////////////////////////////////////////





    // 每次更新内容后，再次调整大小
    adjustSize();
}
